import { opjectNameData } from '../services/api';

export default {
  namespace: 'testmodea',

  state: {
    tableData: [],
    testTypeArr: [],
    monthTotalBug: [],
    radarData: [],
  },

  effects: {
    // *fetch():{} = fetch :function*() {}
    *fetch(_, { call, put }) {
      const response = yield call(opjectNameData);
     // console.log('testmodea/response', response);
      yield put({
        type: 'save',
        payload: response,
      });
    },

    // *fetchSalesData(_, { call, put }) {
    //   const response = yield call(opjectNameData);
    //   yield put({
    //     type: 'save',
    //     payload: {
    //       salesData: response.salesData,
    //     },
    //   });
    // },
  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },

    clear() {
      return {
        // visitData: [],
        // visitData2: [],
        // salesData: [],
        // searchData: [],
        // offlineData: [],
        // offlineChartData: [],
        // salesTypeData: [],
        // salesTypeDataOnline: [],
        // salesTypeDataOffline: [],
        testTypeArr: [],
        tableData: [],
        monthTotalBug: [],
        radarData: [],
      };
    },
  },
};
